package day0224;

public class Test9 {
    public static void main(String[] args) {
        int[][]   a={  {0},
                       {0,0,0},
                       {0,0,0,0,0}  ,
                       {0,0,0,0,0,0,0} ,
                       {0,0,0,0,0,0,0,0,0}  };
        for (int i = 0; i < a.length; i++) {     //i0  5-i
            //小数组
            for (int j = 0; j < a[i].length ; j++) {
                if(j==0  || j==a[i].length-1){
                    a[i][j]=1;
                }else if(j%2 == 1){
                    a[i][j]= ' ';
                }else{
                    //上一个小数组的  [j-1]  和  [j+1]相加
                    a[i][j]=a[i-1][j-2]+a[i-1][j];
                }
            }
        }


        for (int i = 0; i < a.length ; i++) {
            for (int j = 0; j < 5-i   ; j++) { //i1  4
                System.out.print("-");        //i2  3
            }
            for (int j = 0; j < a[i].length; j++) { //j   0---5//本行的第一部分
                if(a[i][j]!=32){
                    System.out.print(a[i][j]);
                }else{
                    System.out.print(" ");
                }
            }
            System.out.println();//本行的第三部分
        }



    }
}
